from py2neo import Graph, Node, Relationship

# 连接到Neo4j数据库
graph = Graph("bolt://localhost:7687", auth=("neo4j", "714716liu"))

# 创建两个Person节点
alice = Node("Person", name="Alice", age=30)
bob = Node("Person", name="Bob", age=25)

# 创建Alice和Bob之间的关系
rel = Relationship(alice, "FRIENDS_WITH", bob)

# 将节点和关系添加到图中
graph.create(alice)
graph.create(bob)
graph.create(rel)

# 查询图中的所有Person节点
result = graph.nodes.match("Person")
for person in result:
    print(person)